package com.anjiplus.template.gaea.business.modules.dataset.dao;

import org.apache.ibatis.annotations.*;

import java.util.Map;

/**
 * @ClassName DiyDataSetStudentIdRelMapper
 * @Description TODO diy的mapper
 * @Author JiJiang
 * @Date 2023/10/29 13:26
 * @Version 1.0
 */
@Mapper
public interface DataSetExternalConfigMapper {

    /**
     * 插入关系
     *
     * @param setCode
     * @param setObject
     * @param studentId
     * @return
     */
    @Insert("insert into diy_data_set_external_conf (data_set_code,data_set_obj,student_code) value (#{dataSetCode},#{dataSetObj},#{studentCode})")
    int insert(@Param("dataSetCode") String setCode, @Param("dataSetObj") String setObject, @Param("studentCode") String studentId);


    /**
     * 查询数量
     *
     * @param setCode
     * @return
     */
    @Select("select count(data_set_code) from diy_data_set_external_conf where data_set_code =#{dataSetCode}")
    int selectCountBySetCode(@Param("dataSetCode") String setCode);


    /**
     * 更新
     *
     * @param setCode
     * @param setObject
     * @param studentId
     * @return
     */
    @Update("update diy_data_set_external_conf set data_set_obj = #{dataSetObj},student_code = #{studentCode} where data_set_code = #{dataSetCode}")
    int update(@Param("dataSetCode") String setCode, @Param("dataSetObj") String setObject, @Param("studentCode") String studentId);


    /**
     * 根据code进行查询
     *
     * @param setCode
     * @return
     */
    @Select("select data_set_code dataSetCode,data_set_obj dataSetObj,student_code studentCode from diy_data_set_external_conf where data_set_code = #{dataSetCode}")
    Map<String, Object> selectBySetCode(@Param("dataSetCode") String setCode);
}
